package com.lqian.controller;

import com.lqian.pojo.Course;
import com.lqian.pojo.User;
import com.lqian.service.WeixinPayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogController {

    @Autowired
    private WeixinPayService weixinPayService;

    // 初始化一个日志对象
    @Autowired
    private static final Logger log = LoggerFactory.getLogger(LogController.class);

    @GetMapping("/log")
    public void testLog(){
        log.trace("----------trace--------");
        log.debug("----------debug--------");
        log.info("----------info--------");
        log.warn("----------warn--------");
        log.error("----------error--------");
    }


    /**
     * @return java.lang.String
     * @Author xuke
     * @Description 打印日志
     * @Date 20:54 2021/6/21
     * @Param []
     **/
    @GetMapping("/logs")
    public String consolelogs() {

        User user = new User();
        user.setUid(1);

        Course course = new Course();
        course.setCourseId(100);
        course.setCourseTitle("学相伴秋招课程班");
        course.setCoursePrice("￥:1999");

        weixinPayService.payCourse(user,course);
        return "success";
    }


}
